Repository navigation
Conversation
|
Can one of the admins verify this patch?
|
There was a problem hiding this comment.
🟡 Changes recommended
The direct-ring path can misinterpret DMA stream IDs as host addresses and overrun small host rings, creating critical memory-corruption risks.
3 open issues
What changed in this PR
This PR repairs IPC3 probe setup and adds direct host-ring extraction for i.MX8MP, paired with the linked Linux probe client.
Changes:
- Fix probe-buffer lookup and zero-initialize DMA configuration structures.
- Add direct copies into a host-provided ring with a published byte counter.
- Enable probes with up to 16 probe points on the i.MX8MP EVK.
| File | Description |
|---|---|
src/probe/probe.c |
Fixes probe setup and adds IPC3 host-ring extraction. |
app/boards/imx8mp_evk_mimx8ml8_adsp.conf |
Enables probes and configures the probe-point limit. |
Review effort: Balanced
|
@ursus161 @bhiregoudar @DINESHKUMARK1 @LongWang100 @dbaluta looks like there is an issue with recent AMD update for IPC3 probes ? My platforms use IPC4 probes so I would recommend the IPC3 probes adopt a similar host interface for tooling reuse. |
|
@lgirdwood, 2 questions as i have to see if we got this correct:
|
The request is for IPC3 users to align on the host mechanisms for IPC3 config/control of probes, and the recommendation is to make it as close to IPC4 as possible for least effort in tool reuse.
Yes. This PR changes part of that change. |
We faced issues with finding the probe points with ipc_get_comp_by_id, so we used the ipc_get_buffer_by_id. Our changes are under macro, they won't affect other platforms. |
c452c06 to
a638664
Compare
Yes, this is a way we could do it, at first hand I implemented it using ipc_get_comp_dev and it went OK. I am pushing hot fixes for this PR and the kernel one for problems left untreated raised by Copilot. I have tested the workflow and all went good, we could use a similar model to existing IPC4 implementation for ease for the least effort, but do you see any problems with this implementation? If yes, please give me a hard time |
|
Hi all, Thanks, |
| @@ -51,8 +51,17 @@ LOG_MODULE_REGISTER(probe, CONFIG_SOF_LOG_LEVEL); | |||
| #define PROBE_POINT_INVALID 0xFFFFFFFF | |||
|
|
|||
| #define PROBE_BUFFER_LOCAL_SIZE 8192 | |||
| /* host buffer layout: u32 write counter in the first bytes, ring data after the header */ | |||
| #define PROBE_HOST_HDR_SIZE 4096 | |||
| #define DMA_ELEM_SIZE 32 | |||
|
|
|||
There was a problem hiding this comment.
In the zephyr/drivers/dma have a look at dma_nxp_sof_host_dma.c. This should provide you a way to "DMA" data into RAM seen by Linux.
There was a problem hiding this comment.
Fair point, switched this to go through nxp_sof_host_dma instead of memcpy'ing myself.
Turns out the real bug was probe_dma_init() never set a dest_address (PROBE_INIT has no host addr field in IPC3), so dma_reload() had nowhere to write to. not that the driver can't reach host RAM. now the kernel passes the ring's bus addr via stream_tag and the driver gets a real destination.
Extraction now does dma_config() to point the block at the next chunk, then the same dma_reload() AMD/Intel use. old probe_host_write() + wrap logic is gone.
Heads up: the driver ignores, or looks a lot like it, reload()'s own args and just replays the last configured block, so this reconfigures every tick (same as host_copy_one_shot() already does in host-zephyr.c). could follow up with a zephyr patch to give it a real cursor so it behaves like an actual host DMA, happy to do that separately if useful.
Testing on the imx8mp-evk shortly, will report back. thanks a lot for the input.
The changes are here for testing: ursus161@d03474a
@ursus161 I'm not using IPC3 for probes, there are differences though with IPC4 probes so it really up to IPC3 user to align on IPC3 based protocol here. I would recommend ping other IPC3 users and keep going. If no other IPC3 users reply than we can probably merge next week. |
a638664 to
936180d
Compare
|
test this please |
IPC3 PROBE_INIT carries no host buffer address: on Intel the kernel programs the destination into the HDA stream, so the firmware never needs one. On i.MX the host DMA (nxp_sof_host_dma) is configured by the firmware itself and was never given a destination, so the extraction channel had nowhere to deliver to and dma_reload() never moved any probe data. Have the kernel pass the bus address of a coherent host buffer in the PROBE_INIT stream_tag field. The buffer is a header page followed by a ring whose size is a power of two of at least the local probe ring. Before every transfer point the host DMA block at the bytes about to go out, at the offset given by the write counter, then let the common dma_reload() path copy them, exactly as on the other Zephyr-native platforms. The transfer size is already clamped at the end of the local ring and the host ring is a multiple of it, so the transfer never has to wrap in the host ring either. The host DMA reports no position, so after each transfer publish the write counter in the first word of the header page for the kernel to poll. Use channel 0 in probe_dma_init() under PROBE_HOST_RING, since stream_tag carries an address there, not a channel index; every other IPC3 platform (e.g. AMD ACP, MediaTek) keeps its previous channel selection unchanged. Also enable CONFIG_PROBE=y and CONFIG_PROBE_POINTS_MAX=16 for the i.MX8MP EVK ADSP board. Signed-off-by: Stefan Ghetu <stefan.ghetu@nxp.com>
936180d to
59b16a6
Compare
| @@ -1249,7 +1353,7 @@ __cold int probe_point_add(uint32_t count, const struct probe_point *probe) | |||
| #elif CONFIG_AMD_ACP_HOST_DMA_PROBE | |||
| dev = ipc_get_buffer_by_id(ipc_get(), buf_id->full_id); | |||
| #else | |||
There was a problem hiding this comment.
Can you please try to use AMD path for this?
#elif CONFIG_AMD_ACP_HOST_DMA_PROBE || CONFIG_IMX_HOST_DMAPROBE
....
```.
Replacing ipc_get_comp_by_id by ipc_get_comp_dev might break Intel probes.
| struct dma_config dma_cfg; | ||
| struct dma_block_config dma_block_cfg; | ||
| struct dma_config dma_cfg = {0}; | ||
| struct dma_block_config dma_block_cfg = {0}; |
There was a problem hiding this comment.
This is a bugfix and should be place din a separate patch even you can send this as a separate PR so we can merge it faster.
There was a problem hiding this comment.
Sure, I will send this as a separate PR.


Fixes IPC3 probes on i.MX8MP (Zephyr) and lets probe data reach the host.
every PROBE_POINT_ADD failed with -EINVAL.
a coherent buffer address in the PROBE_INIT stream_tag, and the firmware
memcpy()s packets into it and publishes a byte counter.
Kernel side: thesofproject/linux#6013
Tested on imx8mp-evk with the kernel PR (1 kHz tone extracted fine).